package com.gitee.melin.bee.core.grpc;

import com.gitee.melin.bee.core.grpc.advice.GrpcAdviceDiscoverer;
import com.gitee.melin.bee.core.grpc.advice.GrpcAdviceExceptionHandler;
import com.gitee.melin.bee.core.grpc.advice.GrpcExceptionHandlerMethodResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/** huaixin 2022/1/28 10:36 AM */
@Configuration(proxyBeanMethods = false)
public class GrpcAdviceConfig {
    @Bean
    public GrpcAdviceDiscoverer grpcAdviceDiscoverer() {
        return new GrpcAdviceDiscoverer();
    }

    @Bean
    public GrpcExceptionHandlerMethodResolver grpcExceptionHandlerMethodResolver(
            final GrpcAdviceDiscoverer grpcAdviceDiscoverer) {
        return new GrpcExceptionHandlerMethodResolver(grpcAdviceDiscoverer);
    }

    @Bean
    public GrpcAdviceExceptionHandler grpcAdviceExceptionHandler(
            GrpcExceptionHandlerMethodResolver grpcExceptionHandlerMethodResolver) {
        return new GrpcAdviceExceptionHandler(grpcExceptionHandlerMethodResolver);
    }
}
